-
Notifications
You must be signed in to change notification settings - Fork 11
Add the public order book extension to the Client #120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add the public order book extension to the Client #120
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR integrates the Public Order Book extension into the Client. It adds new types PublicOrder and PublicOrderFilter, implements a new endpoint to stream public orders, and updates the dependency for the electricity trading API.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/frequenz/client/electricity_trading/_types.py | Added PublicOrder and PublicOrderFilter types with relevant conversion methods. |
| src/frequenz/client/electricity_trading/_client.py | Introduced the receive_public_orders endpoint and maintained the streaming logic for public orders. |
| pyproject.toml | Updated the dependency for frequenz-api-electricity-trading to the new version constraints. |
| RELEASE_NOTES.md | Updated release notes to document dependency changes and the addition of the Public Order Book extension. |
Comments suppressed due to low confidence (1)
src/frequenz/client/electricity_trading/_client.py:977
- The endpoint function name 'receive_public_orders' is inconsistent with the PR description using the singular 'receive_public_order()'. Consider renaming for consistency.
def receive_public_orders(
bfb3b69 to
0751295
Compare
matthias-wende-frequenz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now I've added two small comments. Can you also please add tests?
|
|
||
|
|
||
| @dataclass() | ||
| class PublicOrderFilter: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest to call it PublicOrderBookFilter, because it's used to filter entries in the order book and not filter single orders.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that in the Client it's called PublicOrder I wouldn't. Or we write add *Book everywhere but imo for consistency in the API it's best to not include it in the names.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the client a single entry is called a public order. This class is used as a parameter for an rpc call to query a list of public orders.
| raise | ||
| return self._public_trades_streams[public_trade_filter] | ||
|
|
||
| def receive_public_orders( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest to call this receive_public_order_book and not differ from API terminology.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Same as above)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This receives a stream of public orders, which together form a order book. We should be consistent across client and API. (Also this is a term this is officially in use so we should stick to established terminology).
Ah yes good call, will do! |
* Add the PublicOrder and PublicOrderFilter types * Add the receive_public_order() endpoint * Update the frequenz-api-electricity-trading to >= 0.6.1, < 0.7.0 Signed-off-by: camille-bouvy-frequenz <[email protected]>
Signed-off-by: camille-bouvy-frequenz <[email protected]>
Signed-off-by: camille-bouvy-frequenz <[email protected]>
0751295 to
f9df6a6
Compare
|
Fixed the names (as discussed in previous comments and in our call) and added tests. |
Signed-off-by: Matthias Wende <[email protected]>
This PR integrates the Public Order Book extension to the
Client. More specifically, the changes made are:PublicOrderandPublicOrderFiltertypesreceive_public_order()endpointfrequenz-api-electricity-tradingto >= 0.6.1, < 0.7.0